package copyengine.resource.lazyload
{
	import copyengine.resource.dto.LazyLoadInitDto;
	import copyengine.utils.GeneralUtils;
	import copyengine.utils.UIUtils;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;

	public final class LazyLoadContainerInitHelper
	{
		public function LazyLoadContainerInitHelper()
		{
		}
		
		public static function addLazyLoadIcon(_dto:LazyLoadInitDto , _container:DisplayObjectContainer):void
		{
			var boundArea:Sprite = new Sprite();
			boundArea.graphics.beginFill(0,0.3);
			boundArea.graphics.drawRect(0,0,_dto.swfFileWidth,_dto.swfFileHeight);
			boundArea.graphics.endFill();
			boundArea.x = _dto.swfFilePosX;
			boundArea.y = _dto.swfFilePosY;
			_container.addChild(boundArea);
			
			UIUtils.replaceComponent(_dto.lazyLoadIcon,boundArea,UIUtils.ADJUST_SIZE_SCALE,UIUtils.ADJUST_POS_CENTER_FILL);
		}
		
		public static function removeLazyLoadIcon(_container:DisplayObjectContainer):void
		{
			GeneralUtils.clearChild(_container);
		}
		
	}
}